<?php
class TBB_Controller_Plugin_Layout extends Zend_Controller_Plugin_Abstract
{
	public function preDispatch(Zend_Controller_Request_Abstract $request)
	{
		$this->_layoutSwitch($request->module, $request->module);
	}
	
	private function _layoutSwitch($moduleName = "customer", $layoutName = "customer")
	{		
		Zend_Layout::getMvcInstance()->setLayout($layoutName);
		Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . '/modules/' . $moduleName . '/layouts/scripts');
	}
}